package inherit

import (
	"fmt"
	"reflect"
)

type modelInterface interface {
	GetId()
	GetName()
}

type T1 struct {
	Id   int
	Name string
}

func (t T1) GetId() {

}
func (t T1) GetName() {

}

type T T1

func TestT2() {
	t2 := T3{}
	t2.GetId()
	t3 := T4{}
	t3.GetId()
	t := reflect.TypeOf(t3)
	x := reflect.Zero(t)
	fmt.Println(x)
}

type T2 struct {
	T
	Age int
}

type T3 struct {
	T1
	Age int
}

type T4 struct {
	T3
}

func CreateCompositeObjects(t reflect.Type) reflect.Value {
	return reflect.Zero(t)
}

type TestInterface interface {
	SayHi()
	Age()
	Description()
}

type ObjA struct {
	Name string
}

func (o ObjA) SayHi() {
	fmt.Println("你好", o.Name)
}

func (o ObjA) AgeRep() {
	fmt.Println("我今年默认18A")
}
func (o ObjA) Description() {
	fmt.Println("你好，这是一个默认介绍")
}

type Objc struct{ ObjA }

func Exec() {
	temp := customerStruct{}
	temp.Name = "L"
	temp.Age = 18
	temp.SayHi() //我temp 能执行sayHi 方法
	temp.Description()
	temp.AgeRep()
	refV := reflect.TypeOf(&temp).Elem()
	fmt.Println(refV)
}

type customerStruct struct {
	Objc
	Age int
}

func (o customerStruct) SayHi() {
	fmt.Println("Hi", o.Name)
}
